import settings from "@/settings"
settings.merge({ keys: { access_token: 'access-token' } });
const KEY_TOKEN = settings.keys.access_token

export function getToken() {
  return get(KEY_TOKEN)
}

export function setToken(token) {
  return set(KEY_TOKEN, token)
}

export function removeToken() {
  return remove(KEY_TOKEN)
}

export function get(key) {
  return localStorage.getItem(key)
}

export function getArray(key) {
  const jsonString = get(key);
  return jsonString ? JSON.parse(jsonString) : []
}

export function set(key, value) {
  return localStorage.setItem(key, value)
}

export function remove(key) {
  return localStorage.removeItem(key)
}
